﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using JustinAngel.MetroBlog.Services.Data;

namespace JustinAngel.MetroBlog.Models
{
    public class HomeModel
    {

        public List<Category> Categories { get; set; }
        public List<BlogPost> Articles { get; set; }

        public User User { get; set; }

        public string LatestTweet { get; set; }

        public List<TwitPicModel> TwitPics { get; set; }

        public Category Category0
        {
            get
            {
                return Categories[0];
            }
        }

        public Category Category1
        {
            get
            {
                return Categories[1];
            }
        }

        public Category Category2
        {
            get
            {
                return Categories[2];
            }
        }

        public Category Category3
        {
            get
            {
                return Categories[3];
            }
        }

        public BlogPost Article0
        {
            get
            {
                return Articles[0];
            }
        }

        public BlogPost Article1
        {
            get
            {
                return Articles[1];
            }
        }

        public BlogPost Article2
        {
            get
            {
                return Articles[2];
            }
        }

        public BlogPost Article3
        {
            get
            {
                return Articles[3];
            }
        }

        public BlogPost Article4
        {
            get
            {
                return Articles[4];
            }
        }

        public string TwitPicText0
        {
            get
            {
                return TwitPics.Count > 0 ? TwitPics[0].Title : string.Empty;
            }
        }

        public string TwitPicText1
        {
            get
            {
                return TwitPics.Count > 1 ? TwitPics[1].Title : string.Empty;
            }
        }

        public string TwitPicGuid0
        {
            get
            {
                return GetTwitPicID(0);
            }
        }


        public string TwitPicGuid1
        {
            get
            {
                return GetTwitPicID(1);
            }
        }

        public string TwitPicGuid2
        {
            get
            {
                return GetTwitPicID(2);
            }
        }

        public string TwitPicGuid3
        {
            get
            {
                return GetTwitPicID(3);
            }
        }

        public string TwitPicGuid4
        {
            get
            {
                return GetTwitPicID(4);
            }
        }

        public string TwitPicGuid5
        {
            get
            {
                return GetTwitPicID(5);
            }
        }

        public string TwitPicGuid6
        {
            get
            {
                return GetTwitPicID(6);
            }
        }

        public string TwitPicGuid7
        {
            get
            {
                return GetTwitPicID(7);
            }
        }

        public string TwitPicGuid8
        {
            get
            {
                return GetTwitPicID(8);
            }
        }

        public string TwitPicGuid9
        {
            get
            {
                return GetTwitPicID(9);
            }
        }

        private string GetTwitPicID(int index)
        {
            return TwitPics.Count > index ? TwitPics[index].TwitPicID : string.Empty;
        }
    }
}